package interview;

public class YieldExample {
    public static void main(String[] args) {
        Thread t1 = new Thread(() -> {
            for (int i = 0; i < 5; i++) {
                System.out.println("Thread 1 - " + i);
                Thread.yield(); // 暂时放弃 CPU 使用权
            }
        });

        Thread t2 = new Thread(() -> {
            for (int i = 0; i < 5; i++) {
                System.out.println("Thread 2 - " + i);
            }
        });

        t1.start();
        t2.start();
        int[][] a = new int[2][];
        a[0] = new int[3];
        a[1] = new int[2];
        for(int[] tmp : a){
            for(int cur : tmp){
                System.out.println(cur);
            }
        }
    }
}
